﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Ession
{
    /// <summary>
    /// 用于执行WebBrowser所包含网页中的JavaScript
    /// </summary>
    public class PageJavaScriptRunner
    {
        public static void RegisterFunction(HtmlDocument document, string funcCode)
        {
            try
            {
                HtmlElement ele = document.CreateElement("script");
                ele.SetAttribute("type", "text/javascript");

                ele.SetAttribute("text", funcCode);
                document.Body.AppendChild(ele);
            }
            catch (Exception)
            {
 
            }

        }
    }
}
